// source --> https://www.italiabychiara.com/wp-content/themes/bigbangwp/javascript/google_map_plugin.js?ver=f1a8230f8d50f22c58b45de20d81711e
(function($){
$.fn.extend({
bra_google_map: function(options) {
var defaults = {
//google_api: 'AIzaSyDs8JCxbOANzW9db8UG1LLNDmSq4DUNv4w',
location: '',
zoom: 4
};
var options = $.extend(defaults, options);
return this.each(function() {
var o = options;
var obj = $(this);
var obj_id = obj.attr("id");
var wait = setInterval(function() {
if( $("#" + obj_id).is(":visible") ) {
clearInterval(wait);
// This piece of code will be executed
var obj_class = obj.attr("class");
var geocoder;
var map;
geocoder = new google.maps.Geocoder();
//alert("usao2")
var latlng = new google.maps.LatLng(40, 40); // starting default location
var myOptions = {
zoom: o.zoom,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControl: true,
scrollwheel: false,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.DEFAULT
},
scaleControl: true
}
map = new google.maps.Map(document.getElementById(obj_id), myOptions);
var address = o.location;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}, 200);
}); // return this.each
}
});
})(jQuery);
// source --> https://www.italiabychiara.com/wp-content/themes/bigbangwp/javascript/bra.photostream.js?ver=f1a8230f8d50f22c58b45de20d81711e
(function($){
$.fn.extend({
bra_photostream: function(options) {
var defaults = {
user: 'brankic1979',
limit: 10,
social_network: 'dribbble'
};
function create_html(data, container) {
var feeds = data.feed;
if (!feeds) {
return false;
}
var html = '';
html += '
';
for (var i = 0; i < feeds.entries.length; i++) {
var entry = feeds.entries[i];
var content = entry.content;
html += '- '+ content +'
'
}
html += '
';
$(container).html(html);
$(container).find("li").each(function(){
pin_img_src = $(this).find("img").attr("src");
pin_url = "http://www.pinterest.com" + $(this).find("a").attr("href");
pin_desc = $(this).find("p:nth-child(2)").html();
pin_desc = pin_desc.replace("'", "`");
$(this).empty();
$(this).append("");
var img_w = $(this).find("img").width();
var img_h = $(this).find("img").height();
if (img_w < img_h){
$(this).find("img").addClass("portrait")
}
else {
$(this).find("img").addClass("landscape")
}
});
};
var options = $.extend(defaults, options);
return this.each(function() {
var o = options;
var obj = $(this);
if (o.social_network == "dribbble") {
obj.append("")
$.getJSON("http://dribbble.com/" + o.user + "/shots.json?callback=?", function(data){
$.each(data.shots, function(i,shot){
if (i < o.limit) {
var img_title = shot.title;
img_title = img_title.replace("'", "`")
var image = $('').attr({src: shot.image_teaser_url, alt: img_title});
var url = $('').attr({href: shot.url, target: '_blank', title: img_title});
var url2 = $(url).append(image);
var li = $('').append(url2);
$("ul", obj).append(li);
}
});
$("li img", obj).each(function(){
var img_w = $(this).width();
var img_h = $(this).height();
if (img_w < img_h){
$(this).addClass("portrait")
}
else {
$(this).addClass("landscape")
}
});
});
}
if (o.social_network == "pinterest") {
var url = 'http://pinterest.com/' + o.user + '/feed.rss'
var api = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q=" + encodeURIComponent(url);
api += "&num=" + o.limit;
api += "&output=json_xml"
//alert(api);
// Send request
$.getJSON(api, function(data){
// Check for error
if (data.responseStatus == 200) {
// Process the feeds
create_html(data.responseData, obj);
// Optional user callback function
if ($.isFunction(fn)) fn.call(this,$e);
} else {
alert("wrong user for pinterest");
};
});
}
if (o.social_network == "flickr") {
obj.append("")
$.getJSON("http://api.flickr.com/services/rest/?method=flickr.people.findByUsername&username=" + o.user+ "&format=json&api_key=85145f20ba1864d8ff559a3971a0a033&jsoncallback=?", function(data){
var nsid = data.user.nsid;
$.getJSON("http://api.flickr.com/services/rest/?method=flickr.photos.search&user_id=" + nsid + "&format=json&api_key=85145f20ba1864d8ff559a3971a0a033&per_page=" + o.limit + "&page=1&extras=url_sq&jsoncallback=?", function(data){
$.each(data.photos.photo, function(i,img){
var img_owner = img.owner;
var img_title = img.title;
var img_src = img.url_sq;
var img_id = img.id;
var img_url = "http://www.flickr.com/photos/" + img_owner + "/" + img_id;
var image = $('').attr({src: img_src, alt: img_title});
var url = $('').attr({href: img_url, target: '_blank', title: img_title});
var url2 = $(url).append(image);
var li = $('').append(url2);
$("ul", obj).append(li);
})
});
});
}
if (o.social_network == "instagram") {
obj.append("")
var token = "188312888.f79f8a6.1b920e7f642b4693a4cb346162bf7154";
url = "https://api.instagram.com/v1/users/search?q=" + o.user + "&access_token=" + token + "&count=10&callback=?";
$.getJSON(url, function(data){
$.each(data.data, function(i,shot){
var instagram_username = shot.username;
if (instagram_username == o.user){
var user_id = shot.id;
if (user_id != ""){
url = "https://api.instagram.com/v1/users/" + user_id + "/media/recent/?access_token=" + token + "&count=" + o.limit + "&callback=?";
$.getJSON(url, function(data){
$.each(data.data, function(i,shot){
var img_src = shot.images.thumbnail.url;
var img_url = shot.link;
var img_title = "";
if (shot.caption != null){
img_title = shot.caption.text;
}
var image = $('').attr({src: img_src, alt: img_title});
var url = $('').attr({href: img_url, target: '_blank', title: img_title});
var url2 = $(url).append(image);
var li = $('').append(url2);
$("ul", obj).append(li);
});
});
}
}
});
});
}
}); // return this.each
}
});
})(jQuery);
(function($){
$.fn.extend({
bra_photostream_large: function(options) {
var defaults = {
user: 'brankic1979',
limit: 12,
social_network: 'dribbble',
columns: 4, // 4, 3, 2 columns
shape: 'none'
};
function create_html(data, container, columns, shape) {
var feeds = data.feed;
if (!feeds) {
return false;
}
var html = '';
if (shape == "none") {
html += ''
} else {
html += ''
}
for (var i = 0; i < feeds.entries.length; i++) {
var entry = feeds.entries[i];
var content = entry.content;
if (shape == "none") {
html += '- '+ content +'
'
} else {
html += '- '+ content +'
'
}
}
html += '
';
container.removeClass("photostream");
container.html(html);
container.find("li").each(function(){
pin_img_src = $(this).find("img").attr("src");
pin_img_src = pin_img_src.replace("_b.jpg", "_c.jpg")
pin_url = "http://www.pinterest.com" + $(this).find("a").attr("href");
pin_desc = $(this).find("p:nth-child(2)").html();
pin_desc = pin_desc.replace("'", "`");
$(this).empty();
if (shape == "none") {
$(this).append("");
$(this).append('');
} else {
$(this).append("");
$(this).append('');
}
});
};
var options = $.extend(defaults, options);
return this.each(function() {
var o = options;
var obj = $(this);
if (o.social_network == "dribbble") {
html = "";
if (o.shape == "none") {
html += ''
} else {
html += ''
}
$.getJSON("http://dribbble.com/" + o.user + "/shots.json?callback=?", function(data){
$.each(data.shots, function(i,shot){
if (i < o.limit) {
if (o.shape == "none") {
html += '- ';
} else {
html += '
- ';
}
var img_title = shot.title;
img_title = img_title.replace("'", "`")
if (o.shape == "none") {
html += "";
html += '';
} else {
html += "";
html += '';
}
html += "
";
}
});
html += "
";
obj.append(html);
obj.removeClass("photostream");
$("li img", obj).each(function(){
var img_w = $(this).width();
var img_h = $(this).height();
if (img_w < img_h){
$(this).addClass("portrait")
}
else {
$(this).addClass("landscape")
}
});
});
}
if (o.social_network == "pinterest") {
var url = 'http://pinterest.com/' + o.user + '/feed.rss'
var api = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q=" + encodeURIComponent(url);
api += "&num=" + o.limit;
api += "&output=json_xml"
//alert(api);
// Send request
$.getJSON(api, function(data){
// Check for error
if (data.responseStatus == 200) {
// Process the feeds
create_html(data.responseData, obj, o.columns, o.shape);
// Optional user callback function
if ($.isFunction(fn)) fn.call(this,$e);
} else {
alert("wrong user for pinterest");
};
});
}
if (o.social_network == "flickr") {
html = "";
if (o.shape == "none") {
html += ''
} else {
html += ''
}
$.getJSON("http://api.flickr.com/services/rest/?method=flickr.people.findByUsername&username=" + o.user+ "&format=json&api_key=85145f20ba1864d8ff559a3971a0a033&jsoncallback=?", function(data){
var nsid = data.user.nsid;
$.getJSON("http://api.flickr.com/services/rest/?method=flickr.photos.search&user_id=" + nsid + "&format=json&api_key=85145f20ba1864d8ff559a3971a0a033&per_page=" + o.limit + "&page=1&extras=url_o,url_z,url_m&jsoncallback=?", function(data){
$.each(data.photos.photo, function(i,img){
var img_owner = img.owner;
var img_title = img.title;
var img_src = img.url_z;
var img_src_o = img.url_o;
var img_src_m = img.url_m;
if (img_src_o == undefined) img_src_o = img_src_m;
var img_id = img.id;
var img_url = "http://www.flickr.com/photos/" + img_owner + "/" + img_id;
if (img_src == undefined) img_src = img_src_o;
//if (img_src == undefined) img_src = img_src_b;
if (o.shape == "none") {
html += '- ';
} else {
html += '
- ';
}
if (o.shape == "none") {
html += "";
html += '';
} else {
html += "";
html += '';
}
html += "
";
})
html += "
";
obj.append(html);
obj.removeClass("photostream");
});
});
}
if (o.social_network == "instagram") {
html = "";
if (o.shape == "none") {
html += ''
} else {
html += ''
}
var token = "188312888.f79f8a6.1b920e7f642b4693a4cb346162bf7154";
url = "https://api.instagram.com/v1/users/search?q=" + o.user + "&access_token=" + token + "&count=10&callback=?";
$.getJSON(url, function(data){
$.each(data.data, function(i,shot){
var instagram_username = shot.username;
if (instagram_username == o.user){
var user_id = shot.id;
if (user_id != ""){
url = "https://api.instagram.com/v1/users/" + user_id + "/media/recent/?access_token=" + token + "&count=" + o.limit + "&callback=?";
$.getJSON(url, function(data){
$.each(data.data, function(i,shot){
if (o.shape == "none") {
html += '- ';
} else {
html += '
- ';
}
var img_src = shot.images.standard_resolution.url;
var img_src_o = shot.images.standard_resolution.url;
var img_url = shot.link;
var img_title = "";
if (shot.caption != null){
img_title = shot.caption.text;
}
if (o.shape == "none") {
html += "";
html += '';
} else {
html += "";
html += '';
}
html += "
";
});
html += "
";
obj.append(html);
obj.removeClass("photostream");
});
}
}
});
});
}
}); // return this.each
}
});
})(jQuery);